//package cn.ycbjie.ycaudioplayer.newpack.linkagescroll.contentmode;
//
//import android.annotation.SuppressLint;
//import android.os.Build;
//import android.os.Bundle;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.webkit.WebSettings;
//
//
//import com.synjones.minnovate.frame.basesdk.http.SynHttp;
//import com.synjones.minnovate.frame.basesdk.http.SynSchedulersTranfs;
//import com.synjones.minnovate.frame.basesdk.http.exception.AbsRxSubscriber;
//import com.synjones.minnovate.frame.basesdk.http.exception.ApiException;
//import com.synjones.minnovate.frame.basesdk.log.SynLog;
//
//import org.json.JSONException;
//import org.json.JSONObject;
//
//import cn.ycbjie.ycaudioplayer.R;
//import cn.ycbjie.ycaudioplayer.newpack.linkagescroll.contentmode.adp.PageAdapterTab;
//import cn.ycbjie.ycaudioplayer.newpack.linkagescroll.contentmode.wight.MyWebViewClient;
//import cn.ycbjie.ycaudioplayer.newpack.linkagescroll.iapiserver.iapi;
//import cn.ycbjie.ycaudioplayer.newpack.linkagescroll.widget.FoundWebView;
//
//public class Introduction_Tab1 extends ScrollTabHolderFragment {
////
////    private PullToRefreshListView listView;
////
////    private View placeHolderView;
////
////    private ArrayAdapter<String> adapter;
////
////    private ArrayList<String> listItems;
////
////    private Handler handler;
//    private FoundWebView web;
//
//    public Introduction_Tab1() {
//        this.setFragmentId(PageAdapterTab.PAGE_TAB1.fragmentId);
//    }
//
//    @Override
//    public void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//    }
//
//    @Override
//    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//        return inflater.inflate(R.layout.page1_tab_fragment_introduction, container, false);
//    }
//
//    @Override
//    public void onActivityCreated(Bundle savedInstanceState) {
//        super.onActivityCreated(savedInstanceState);
//        findViews();
////        initListView();
//    }
//    @SuppressLint("InflateParams")
//    private void findViews() {
//        web = (FoundWebView) getView().findViewById(R.id.web);
//
//        WebSettings settings = web.getSettings();
//        settings.setJavaScriptEnabled(true);
//        settings.setDomStorageEnabled(true);
//        settings.setUseWideViewPort(true);
//        settings.setLoadWithOverviewMode(true);
//        web.setWebViewClient(new MyWebViewClient());
//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//            settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
//        } else {
//            settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
//        }
//        if (web.isHardwareAccelerated()) settings.setJavaScriptEnabled(true);
//        getxiangqing();
//
//        web.setOnCustomScroolChangeListener(new FoundWebView.ScrollInterface() {
//
//            @Override
//
//            public void onSChanged(int l, int t, int oldl, int oldt) {
//
//
//
//// TODO Auto-generated method stub
//
//                float webcontent = web.getContentHeight()*web.getScale();//webview的高度
//
//                float webnow = web.getHeight()+ web.getScrollY();//当前webview的高度
//
//                if( web.getContentHeight()* web.getScale() -( web.getHeight()+ web.getScrollY())==0){
//
//
//
////已经处于底端
//
////                    lay_bottom_layout.setVisibility(View.VISIBLE);
//
//web.requestDisallowInterceptTouchEvent(false);
//
//                }else {
//
////                    lay_bottom_layout.setVisibility(View.GONE);
//                    web.requestDisallowInterceptTouchEvent(true);
//
//                }
//
////已经处于顶端
//
//                if (web.getScaleY() == 0) {
//
//                }
//
//            }});
////        handler = new Handler(Looper.getMainLooper());
////        listView = (PullToRefreshListView) getView().findViewById(R.id.page_tab_listview);
//    }
//
////    private void setListViewListener() {
////        listView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
////
////            @Override
////            public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
////                loadNews();
////            }
////
////            @Override
////            public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
////                loadOlds();
////            }
////
////        });
////
////        listView.setOnScrollListener(new OnScrollListener() {
////
////            @Override
////            public void onScrollStateChanged(AbsListView view, int scrollState) {
////            }
////
////            @Override
////            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
////                if (scrollTabHolder != null) {
////                    scrollTabHolder.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount, getFragmentId());
////                }
////            }
////        });
//
////        web.setOnHeaderScrollListener(new PullToRefreshListView.OnHeaderScrollListener() {
////
////            @Override
////            public void onHeaderScroll(boolean isRefreashing, boolean istop, int value) {
////                if (scrollTabHolder != null && istop) {
////                    scrollTabHolder.onHeaderScroll(isRefreashing, value, getFragmentId());
////                }
////            }
////        });
////    }
//
//    private String getHtmlData(String bodyHTML) {
//        String head = "<head>" +
//                "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"> " +
//                "<style>html{padding:15px;} body{word-wrap:break-word;font-size:13px;padding:0px;margin:0px} p{padding:0px;margin:0px;font-size:13px;color:#222222;line-height:1.3;} img{padding:0px,margin:0px;max-width:100%; width:auto; height:auto;}</style>" +
//                "</head>";
//        return "<html>" + head + "<body>" + bodyHTML + "</body></html>";
//    }
//
//    private void getxiangqing() {
//
//
//        SynHttp.getInstance().getApi("https://sapis.hkrstore.com", iapi.class).getContent("jneregopaugn")
//                .compose(SynSchedulersTranfs.<String>schedulersTransformer())
//                .subscribe(new AbsRxSubscriber<String>() {
//                    @Override
//                    public void onRxError(ApiException ex) {
//                        SynLog.file(ex.getDisplayMessage());
//                    }
//
//                    public void onNext(String weatherInfoBean) {
//                        try {
//                            JSONObject jsonObject = new JSONObject(weatherInfoBean);
//                            JSONObject jsonObject1 = jsonObject.getJSONObject("data");
//                            String contents = jsonObject1.getString("content");
//                            String gengxin = jsonObject1.getString("summary");
//                            String laiyuan = jsonObject1.getString("authors");
//                            String biaoti = jsonObject1.getString("title");
//                            String imgurl = jsonObject1.getString("cover");
//                            String jiages = jsonObject1.getString("price");
//                            web.loadData(getHtmlData(contents), "text/html;charset=utf-8", "utf-8");
//                                                                //ScrollInterface
////                            web.setOnCustomScroolChangeListener(new ScrolInterface)
//
//// tv_gengxin.setText(gengxin);
////                            tv_laiyuan.setText(laiyuan);
////                            tv_title.setText(biaoti);
////                            tv_jiage.setText(jiages);
//
////                            SynImage.into(test_musicplayer.this, imgurl, im_banner_title);
////                            getmp3list("5","1");
////                            String url="http://fdfs.xmcdn.com/group19/M00/3B/21/wKgJK1ePRjLwvXl0AAy74JiGcgw431.mp3";
////                            player.playUrl(url);
//                        } catch (JSONException e) {
//                            e.printStackTrace();
//                        }
//                        SynLog.file("String----->" + weatherInfoBean.toString());
//                    }
//                });
//    }
//
//
////    private void initListView() {
//////        setListViewListener();
//////        listViewAddHeader();
//////        listViewLoadData();
////    }
//
////    private void setListViewListener() {
////        listView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
////
////            @Override
////            public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
////                loadNews();
////            }
////
////            @Override
////            public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
////                loadOlds();
////            }
////
////        });
////
////        listView.setOnScrollListener(new OnScrollListener() {
////
////            @Override
////            public void onScrollStateChanged(AbsListView view, int scrollState) {
////            }
////
////            @Override
////            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
////                if (scrollTabHolder != null) {
////                    scrollTabHolder.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount, getFragmentId());
////                }
////            }
////        });
////        listView.setOnHeaderScrollListener(new PullToRefreshListView.OnHeaderScrollListener() {
////
////            @Override
////            public void onHeaderScroll(boolean isRefreashing, boolean istop, int value) {
////                if (scrollTabHolder != null && istop) {
////                    scrollTabHolder.onHeaderScroll(isRefreashing, value, getFragmentId());
////                }
////            }
////        });
////    }
////
////    private void listViewAddHeader() {
////        placeHolderView = new LinearLayout(getActivity());
////        AbsListView.LayoutParams params = new LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, scrollTabHolder
////                .headerHeight());
////        placeHolderView.setLayoutParams(params);
////        listView.getRefreshableView().addHeaderView(placeHolderView);
////    }
////
//
//    @Override
//    public void headerChange() {
////        AbsListView.LayoutParams params = (LayoutParams) placeHolderView.getLayoutParams();
////        params.height = scrollTabHolder.headerHeight();
////        placeHolderView.setLayoutParams(params);
//    }
////
////    protected void listViewLoadData() {
////        listItems = new ArrayList<String>();
////        for (int i = 1; i <= 50; i++) {
////            listItems.add("currnet page: " + (getFragmentId() + 1) + " item --" + i);
////        }
////        adapter = new ArrayAdapter<String>(getActivity(), R.layout.content_list_item, android.R.id.text1, listItems);
////        listView.setAdapter(adapter);
////        loadNews();
////    }
////
////    /**
////     * 模拟加载数据
////     */
////    private void loadNews() {
////        handler.postDelayed(new Runnable() {// ģ��Զ�̻�ȡ���
////
////            @Override
////            public void run() {
////                stopRefresh();
////            }
////        }, 300);
////    }
////
////    private void notifyAdapterDataChanged() {
////        if (adapter != null) {
////            adapter.notifyDataSetChanged();
////        }
////    }
////
////    protected void loadOlds() {
////        handler.postDelayed(new Runnable() {// ģ��Զ�̻�ȡ���
////
////            @Override
////            public void run() {
////                stopRefresh();
////                int size = listItems.size() + 1;
////                for (int i = size; i < size + 50; ++i) {
////                    listItems.add("currnet page: " + (getFragmentId() + 1) + " item --" + i);
////                }
////                notifyAdapterDataChanged();
////            }
////        }, 300);
////    }
////
//    // PullToRefreshListView 滚动调整
//    @Override
//    public void adjustScroll(int scrollHeight) {
////        if (scrollHeight == 0 && listView.getRefreshableView().getFirstVisiblePosition() >= 2) {
////            return;
////        }
////        //Log.d(getTag(), "scrollHeight:" + scrollHeight);
////        listView.getRefreshableView().setSelectionFromTop(2, scrollHeight);
//        //		Log.d(getTag(), "getScrollY:" + getScrollY(listView.getRefreshableView()));
//        //		handler.postDelayed(new Runnable() {
//        //
//        //			@Override
//        //			public void run() {
//        //				Log.d(getTag(), "getScrollY:" + getScrollY(listView.getRefreshableView()));
//        //			}
//        //		}, 5000);
//    }
////
////    public int getScrollY(AbsListView view) {
////        View c = view.getChildAt(0);
////        if (c == null) {
////            return 0;
////        }
////        int top = c.getTop();
////        int firstVisiblePosition = view.getFirstVisiblePosition();
////        if (firstVisiblePosition == 0) {
////            return -top;
////        } else if (firstVisiblePosition == 1) {
////            return top;
////        } else {
////            return -top + (firstVisiblePosition - 2) * c.getHeight() + 683;
////        }
////    }
////
////    protected void updateListView() {
////        if (adapter != null) {
////            adapter.notifyDataSetChanged();
////        }
////    }
////
////    protected void stopRefresh() {
////        listView.onRefreshComplete();
////    }
//}